<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  
  
  <link rel="shortcut icon" href="../../img/favicon.ico">
  <title>evq.h - COROS Documentation</title>
  <link rel="stylesheet" href="../../css/theme.css" />
  <link rel="stylesheet" href="../../css/theme_extra.css" />
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css" />
  
  <script>
    // Current page data
    var mkdocs_page_name = "evq.h";
    var mkdocs_page_input_path = "reference/02_evq.md";
    var mkdocs_page_url = null;
  </script>
  
  <script src="../../js/jquery-2.1.1.min.js" defer></script>
  <script src="../../js/modernizr-2.8.3.min.js" defer></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
  <script>hljs.initHighlightingOnLoad();</script> 
  
</head>

<body class="wy-body-for-nav" role="document">

  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
    <div class="wy-side-scroll">
      <div class="wy-side-nav-search">
        <a href="../.." class="icon icon-home"> COROS Documentation</a>
        <div role="search">
  <form id ="rtd-search-form" class="wy-form" action="../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" title="Type search term here" />
  </form>
</div>
      </div>

      <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
                <ul>
                    <li class="toctree-l1"><a class="reference internal" href="../..">Home</a>
                    </li>
                </ul>
                <p class="caption"><span class="caption-text">About</span></p>
                <ul>
                    <li class="toctree-l1"><a class="reference internal" href="../../COPYRIGHT/">Copyright</a>
                    </li>
                    <li class="toctree-l1"><a class="reference internal" href="../../LICENSE/">License</a>
                    </li>
                </ul>
                <p class="caption"><span class="caption-text">The Beginner's Guide to:</span></p>
                <ul>
                    <li class="toctree-l1"><a class="reference internal" href="../../tutorials/01_getting_started/">Getting Started</a>
                    </li>
                </ul>
                <p class="caption"><span class="caption-text">The Hitchker's Guide to:</span></p>
                <ul>
                    <li class="toctree-l1"><a class="reference internal" href="../../guides/01_coroutines/">Coroutines</a>
                    </li>
                    <li class="toctree-l1"><a class="reference internal" href="../../guides/02_event_queues/">Event Queues</a>
                    </li>
                    <li class="toctree-l1"><a class="reference internal" href="../../guides/03_components/">Components</a>
                    </li>
                </ul>
                <p class="caption"><span class="caption-text">The Technocrat's Guide to:</span></p>
                <ul class="current">
                    <li class="toctree-l1"><a class="reference internal" href="../01_co/">co.h</a>
                    </li>
                    <li class="toctree-l1 current"><a class="reference internal current" href="./">evq.h</a>
    <ul class="current">
    <li class="toctree-l2"><a class="reference internal" href="#data-types">Data types</a>
    </li>
    <li class="toctree-l2"><a class="reference internal" href="#user-supplied-callbacks">User-supplied callbacks</a>
        <ul>
    <li class="toctree-l3"><a class="reference internal" href="#tick_ms-evq_get_tickvoid">tick_ms evq_get_tick(void);</a>
    </li>
        </ul>
    </li>
    <li class="toctree-l2"><a class="reference internal" href="#api">API</a>
        <ul>
    <li class="toctree-l3"><a class="reference internal" href="#evq_queue_t-evq_create_queuevoid">evq_queue_t evq_create_queue(void);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#void-evq_attach_queueevq_queue_t-parent-evq_queue_t-child">void evq_attach_queue(evq_queue_t parent, evq_queue_t child);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#void-evq_detach_queueevq_queue_t-child">void evq_detach_queue(evq_queue_t child);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#evq_event_t-evq_create_fn_eventdelay_ms-delay-delay_ms-period-evq_callback-cb-void-data">evq_event_t evq_create_fn_event(delay_ms delay, delay_ms period, evq_callback cb, void *data);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#void-evq_fill_fn_eventevq_event_t-e-delay_ms-delay-delay_ms-period-evq_callback-cb-void-data">void evq_fill_fn_event(evq_event_t e, delay_ms delay, delay_ms period, evq_callback cb, void *data);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#evq_event_t-evq_create_co_eventdelay_ms-delay-delay_ms-period-co_t-co-void-data">evq_event_t evq_create_co_event(delay_ms delay, delay_ms period, co_t co, void *data);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#void-evq_fill_co_eventevq_event_t-e-delay_ms-delay-delay_ms-period-co_t-co-void-data">void evq_fill_co_event(evq_event_t e, delay_ms delay, delay_ms period, co_t co, void *data);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#void-evq_post_eventevq_queue_t-q-evq_event_t-e">void evq_post_event(evq_queue_t q, evq_event_t e);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#void-evq_cancel_eventevq_event_t-e">void evq_cancel_event(evq_event_t e);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#delay_ms-evq_query_time_remainingevq_event_t-e">delay_ms evq_query_time_remaining(evq_event_t e);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#void-evq_destroy_eventevq_event_t-e">void evq_destroy_event(evq_event_t e);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#evq_event_t-evq_queue_nowevq_queue_t-q-evq_callback-cb-void-data">evq_event_t evq_queue_now(evq_queue_t q, evq_callback cb, void *data);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#evq_event_t-evq_queue_inevq_queue_t-q-evq_callback-cb-void-data-delay_ms-delay">evq_event_t evq_queue_in(evq_queue_t q, evq_callback cb, void *data, delay_ms delay);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#evq_event_t-evq_queue_everyevq_queue_t-q-evq_callback-cb-void-data-delay_ms-period">evq_event_t evq_queue_every(evq_queue_t q, evq_callback cb, void *data, delay_ms period);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#evq_event_t-evq_resume_nowevq_queue_t-q-co_t-co-void-dataevq_event_t-evq_resume_inevq_queue_t-q-co_t-co-void-data-delay_ms-delayevq_event_t-evq_resume_everyevq_queue_t-q-co_t-co-void-data-delay_ms-period">evq_event_t evq_resume_now(evq_queue_t q, co_t co, void *data);,evq_event_t evq_resume_in(evq_queue_t q, co_t co, void *data, delay_ms delay);,evq_event_t evq_resume_every(evq_queue_t q, co_t co, void *data, delay_ms period);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#void-evq_processevq_queue_t-q-evq_idle-i">void evq_process(evq_queue_t q, evq_idle i);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#void-evq_process_forevq_queue_t-q-delay_ms-ms-evq_idle-i">void evq_process_for(evq_queue_t q, delay_ms ms, evq_idle i);</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#void-evq_process_one_tickevq_queue_t-q-evq_idle-i">void evq_process_one_tick(evq_queue_t q, evq_idle i);</a>
    </li>
        </ul>
    </li>
    </ul>
                    </li>
                    <li class="toctree-l1"><a class="reference internal" href="../03_comp/">comp.h</a>
                    </li>
                </ul>
                <p class="caption"><span class="caption-text">The Technomancer's Guide to:</span></p>
                <ul>
                    <li class="toctree-l1"><a class="reference internal" href="../../architecture/01_coroutines/">Coroutines</a>
                    </li>
                    <li class="toctree-l1"><a class="reference internal" href="../../architecture/02_event_queues/">Event Queues</a>
                    </li>
                    <li class="toctree-l1"><a class="reference internal" href="../../architecture/03_porting/">Porting</a>
                    </li>
                </ul>
      </div>
    </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
        <a href="../..">COROS Documentation</a>
      </nav>

      
      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href="../..">Docs</a> &raquo;</li>
    
      
        
          <li>The Technocrat's Guide to: &raquo;</li>
        
      
    
    <li>evq.h</li>
    <li class="wy-breadcrumbs-aside">
      
    </li>
  </ul>
  
  <hr/>
</div>
          <div role="main">
            <div class="section">
              
                <h1 id="the-technocrats-guide-to-evqh">The Technocrat's Guide to <code>evq.h</code></h1>
<p>EVQ is a sophisticated event queue for COROS.  It is used to decouple components in a system by having them communicate solely in terms of events.  Events can be seen as simple "wake up" calls or as sophisticated messages.  Event handlers can be simple callback functions or full-blown, independent coroutines (using the CO component).</p>
<p>Events are placed into an event queue.  Event queues are placed into a tree-structured event environment.  Posting an event to an event queue makes it processed by any event queue higher in the chain; similarly, telling an event queue to process events will process ALL triggered events in ALL child queues.  This tree structure permits componentization where standalone components post messages to their own queues that are linked as children into a system-wide main queue, keeping all internal operational details to themselves.  When it is vital that a particular component processes its own messages without other components intervening, having a child queue get processed accomplishes this end.</p>
<p>Event queues are first class entities and can be passed around from task to task, even in messages, making Pi Calculus-like operations plausible as well.</p>
<p>Event queues are managed by these functions:</p>
<ul>
<li><code>evq_create_queue();</code></li>
<li><code>evq_attach_queue();</code></li>
<li><code>evq_detach_queue();</code></li>
</ul>
<p>Persistent events are managed by these functions:</p>
<ul>
<li><code>evq_create_fn_event();</code></li>
<li><code>evq_create_co_event();</code></li>
<li><code>evq_post_event();</code></li>
<li><code>evq_cancel_event();</code></li>
<li><code>evq_query_time_remaining();</code></li>
<li><code>evq_destroy_event();</code></li>
</ul>
<p>Note that <code>evq_create_fn_event()</code> is for normal callback function events while <code>evq_create_co_event()</code> is for coroutine events.</p>
<p>Ad-hoc callback events are managed by these functions:</p>
<ul>
<li><code>evq_queue_now();</code></li>
<li><code>evq_queue_in();</code></li>
<li><code>evq_queue_every();</code></li>
</ul>
<p>Ad-hoc coroutine events are managed by these functions:</p>
<ul>
<li><code>evq_resume_now();</code></li>
<li><code>evq_resume_in();</code></li>
<li><code>evq_resume_every();</code></li>
</ul>
<p>Events are processed by these functions:</p>
<ul>
<li><code>evq_process();</code></li>
<li><code>evq_process_for();</code></li>
<li><code>evq_process_one_tick();</code></li>
</ul>
<p>The user must provide the following function implementation.
- evq_get_tick();</p>
<h2 id="data-types">Data types</h2>
<ul>
<li><code>typedef uint32_t delay_ms;</code>                &ndash; type used in delays</li>
<li><code>typedef uint64_t tick_ms;</code>                 &ndash; type used in timer tick counts</li>
<li><code>typedef struct _evq_queue_t *evq_queue_t;</code> &ndash; event queue handle type</li>
<li><code>typedef struct _evq_event_t *evq_event_t;</code> &ndash; event handle type</li>
<li><code>typedef void (*evq_callback)(void *);</code>     &ndash; callback function type</li>
<li><code>typedef void (*evq_idle)(void);</code>           &ndash; idle loop callback function type</li>
</ul>
<h2 id="user-supplied-callbacks">User-supplied callbacks</h2>
<hr />
<h3 id="tick_ms-evq_get_tickvoid"><code>tick_ms evq_get_tick(void);</code></h3>
<p>All operations in the EVQ work on millisecond scales.  The queue processing loop must know what the current millisecond tick count is to function.  This function must be provided by the end-user and the tick value returned (a 64-bit value, note!) must be guaranteed <em>not</em> to wrap around for approximately 500 million years.  (This is another way of saying it must be a 64-bit value.)</p>
<hr />
<h2 id="api">API</h2>
<hr />
<h3 id="evq_queue_t-evq_create_queuevoid"><code>evq_queue_t evq_create_queue(void);</code></h3>
<p>Create an event queue object.  Event queues, once created, are never released for the run time of the program.</p>
<p>This function returns a pointer to an opaque data type as a handle that is used in all other functions in this library.</p>
<hr />
<h3 id="void-evq_attach_queueevq_queue_t-parent-evq_queue_t-child"><code>void evq_attach_queue(evq_queue_t parent, evq_queue_t child);</code></h3>
<p>Attach a child queue to a parent.  To help in modularity, event queues can be module-specific and attached together in a tree structure.  When processing events on a queue, all events on the named queue are processed.  If there is then an attached child, control is passed down to that child and so on until all attached sub-queues have been processed.</p>
<p><code>parent</code> (in)</p>
<blockquote>
<p>The uplink queue in the relationship.</p>
</blockquote>
<p><code>child</code> (in)</p>
<blockquote>
<p>The downlink queue in the relationship.</p>
</blockquote>
<p>Note that there is a slight computational cost to chained queues in the form of an extra pointer redirection and a recursive function call for each additional member.</p>
<hr />
<h3 id="void-evq_detach_queueevq_queue_t-child"><code>void evq_detach_queue(evq_queue_t child);</code></h3>
<p>Remove a child queue from a chain.  Once a child is removed from a parent, events processed on the parent will not descend to the child.</p>
<p><code>child</code> (in)</p>
<blockquote>
<p>The downlink queue to be removed.  Each child knows its parent so there is no need to supply the parent here.</p>
</blockquote>
<hr />
<h3 id="evq_event_t-evq_create_fn_eventdelay_ms-delay-delay_ms-period-evq_callback-cb-void-data"><code>evq_event_t evq_create_fn_event(delay_ms delay, delay_ms period, evq_callback cb, void *data);</code></h3>
<p>Manually create a callback event with particular characteristics.  This forms part of the low-level interface to the event queue system and its chief use lies in preparing pre-arranged signals for exceptional events and such.</p>
<p><code>delay</code> (in)</p>
<blockquote>
<p>The delay in milliseconds before the event callback fires.</p>
</blockquote>
<p><code>period</code> (in)</p>
<blockquote>
<p>If non-zero establishes a periodic event with <code>period</code> milliseconds between callback firings.</p>
</blockquote>
<p><code>cb</code> (in)</p>
<blockquote>
<p>The callback function to be called when firing.</p>
</blockquote>
<p><code>data</code> (in)</p>
<blockquote>
<p>The data to be passed to the callback functions.</p>
</blockquote>
<p>The created event handle is returned or <code>NULL</code> to signify failure.  It should be noted that the various <code>queue_*()</code> functions make use of this function behind the scenes.</p>
<hr />
<h3 id="void-evq_fill_fn_eventevq_event_t-e-delay_ms-delay-delay_ms-period-evq_callback-cb-void-data"><code>void evq_fill_fn_event(evq_event_t e, delay_ms delay, delay_ms period, evq_callback cb, void *data);</code></h3>
<p>Fill a previously-created event with modified elements.  This forms part of the low-level interface to the event queue system and its chief use lies in preparing pre-arranged signals for exceptional events and such.</p>
<p><code>e</code> (in)</p>
<blockquote>
<p>The event object being modified.</p>
</blockquote>
<p><code>delay</code>, <code>period</code>, <code>cb</code>, <code>data</code> (in)</p>
<blockquote>
<p>These are exactly the same as parameters of the same name in <code>evq_create_fn_event()</code>.</p>
</blockquote>
<p>The various <code>queue_*()</code> functions make use of this function behind the scenes.</p>
<hr />
<h3 id="evq_event_t-evq_create_co_eventdelay_ms-delay-delay_ms-period-co_t-co-void-data"><code>evq_event_t evq_create_co_event(delay_ms delay, delay_ms period, co_t co, void *data);</code></h3>
<p>Manually create a coroutine event with particular characteristics.  It is a low-level interface to the event queue system useful mainly for preparing signals for exceptional events and such.</p>
<p><code>delay</code> (in)</p>
<blockquote>
<p>The delay in milliseconds before the event coroutine is resumed.</p>
</blockquote>
<p><code>period</code> (in)</p>
<blockquote>
<p>For periodic events, the separation between callback firings.</p>
</blockquote>
<p><code>cb</code> (in)</p>
<blockquote>
<p>The callback coroutine to be resumed when firing.</p>
</blockquote>
<p><code>data</code> (in)</p>
<blockquote>
<p>The data to be passed to the callback coroutine.</p>
</blockquote>
<p>The various <code>resume_*()</code> functions make use of this function behind the scenes.</p>
<hr />
<h3 id="void-evq_fill_co_eventevq_event_t-e-delay_ms-delay-delay_ms-period-co_t-co-void-data"><code>void evq_fill_co_event(evq_event_t e, delay_ms delay, delay_ms period, co_t co, void *data);</code></h3>
<p>Fill a previously-created event with modified elements.  This forms part of the low-level interface to the event queue system and its chief use lies in preparing pre-arranged signals for exceptional events and such.</p>
<p><code>e</code> (in)</p>
<blockquote>
<p>The event object being filled.</p>
</blockquote>
<p><code>delay</code>, <code>period</code>, <code>cb</code>, <code>data</code></p>
<blockquote>
<p>These are exactly the same as parameters of the same name in <code>evq_create_co_event()</code>.</p>
</blockquote>
<p>The various <code>queue_*()</code> functions make use of this function behind the scenes.</p>
<hr />
<h3 id="void-evq_post_eventevq_queue_t-q-evq_event_t-e"><code>void evq_post_event(evq_queue_t q, evq_event_t e);</code></h3>
<p>Manually insert an event (callback or coroutine) according to its delay and period data established at creation into a given event queue.</p>
<p><code>q</code> (in)</p>
<blockquote>
<p>The event queue which will be processing the event.</p>
</blockquote>
<p><code>e</code> (in)</p>
<blockquote>
<p>The event to be inserted.</p>
</blockquote>
<hr />
<h3 id="void-evq_cancel_eventevq_event_t-e"><code>void evq_cancel_event(evq_event_t e);</code></h3>
<p>Removes a queued event from its queued location but does not delete the event object.</p>
<p><code>e</code> (in)</p>
<blockquote>
<p>The event to be cancelled.</p>
</blockquote>
<p><strong><em>NB: DO NOT EVER TRY TO CANCEL A NON-PERIODIC EVENT WHICH HAS ALREADY FIRED!  THIS WILL CORRUPT MEMORY!</em></strong></p>
<hr />
<h3 id="delay_ms-evq_query_time_remainingevq_event_t-e"><code>delay_ms evq_query_time_remaining(evq_event_t e);</code></h3>
<p>Query the time remaining on a deferred event, returning the number of milliseconds before an event will fire.</p>
<p><code>e</code> (in)</p>
<blockquote>
<p>The event to be cancelled.</p>
</blockquote>
<p><strong><em>NB: DO NOT EVER TRY TO QUERY A NON-PERIODIC EVENT WHICH HAS ALREADY FIRED!  THIS WILL CORRUPT MEMORY!</em></strong></p>
<hr />
<h3 id="void-evq_destroy_eventevq_event_t-e"><code>void evq_destroy_event(evq_event_t e);</code></h3>
<p>Destroy an event object by cancelling it (if running) and then reclaiming its memory.</p>
<p><code>e</code> (in)</p>
<blockquote>
<p>The event to be deleted.</p>
</blockquote>
<p><strong><em>NB: THIS FUNCTION IS AUTOMATICALLY CALLED AFTER AN IMMEDIATE OR DEFFERED EVENT HAS FIRED.  IT IS AN ERROR TO CALL IT AFTERWARD!</em></strong></p>
<hr />
<h3 id="evq_event_t-evq_queue_nowevq_queue_t-q-evq_callback-cb-void-data"><code>evq_event_t evq_queue_now(evq_queue_t q, evq_callback cb, void *data);</code></h3>
<p>Create <em>and</em> queue a callback event for processing the next time one of the <code>process_*()</code> functions is called.</p>
<p><code>q</code> (in)</p>
<blockquote>
<p>The queue to place the event on.</p>
</blockquote>
<p><code>cb</code> (in)</p>
<blockquote>
<p>The callback function to be called.</p>
</blockquote>
<p><code>data</code> (in)</p>
<blockquote>
<p>The data to be passed to the callback function.</p>
</blockquote>
<p>This function returns the handle to the created event object, <code>NULL</code> on failure.  The created event is as if called with <code>evq_create_fn_event(0, 0, cb, data);</code>.</p>
<hr />
<h3 id="evq_event_t-evq_queue_inevq_queue_t-q-evq_callback-cb-void-data-delay_ms-delay"><code>evq_event_t evq_queue_in(evq_queue_t q, evq_callback cb, void *data, delay_ms delay);</code></h3>
<p>Create and queue a callback event for processing after a given number of milliseconds has passed.</p>
<p><code>q</code>, <code>cb</code>, <code>data</code> (in)</p>
<blockquote>
<p>Exactly the same as the parameters of <code>evq_queue_now()</code>.</p>
</blockquote>
<p><code>delay</code> (in)</p>
<p>The number of milliseconds to wait before firing the event.</p>
<p>This function returns the handle to the created event object, <code>NULL</code> on failure.  The created event is as if called with <code>evq_create_fn_event(delay, 0, cb, data);</code>.</p>
<hr />
<h3 id="evq_event_t-evq_queue_everyevq_queue_t-q-evq_callback-cb-void-data-delay_ms-period"><code>evq_event_t evq_queue_every(evq_queue_t q, evq_callback cb, void *data, delay_ms period);</code></h3>
<p>Create and queue a callback event for processing after the given number of milliseconds has passed and every same period thereafter.</p>
<p><code>q</code>, <code>cb</code>, <code>data</code> (in)</p>
<blockquote>
<p>Exactly the same as the parameters of <code>evq_queue_now()</code>.</p>
</blockquote>
<p><code>period</code> (in)</p>
<blockquote>
<p>Serves as the initial delay for the event as well as the period.  A period of 10 will delay 10ms before firing the event and then fire every 10ms thereafter, for example.</p>
</blockquote>
<p>This function returns the handle to the created event object, <code>NULL</code> on failure.  The created event is as if called with <code>evq_create_fn_event(period, period, cb, data);</code>.</p>
<hr />
<h3 id="evq_event_t-evq_resume_nowevq_queue_t-q-co_t-co-void-dataevq_event_t-evq_resume_inevq_queue_t-q-co_t-co-void-data-delay_ms-delayevq_event_t-evq_resume_everyevq_queue_t-q-co_t-co-void-data-delay_ms-period"><code>evq_event_t evq_resume_now(evq_queue_t q, co_t co, void *data);</code>,<br/><code>evq_event_t evq_resume_in(evq_queue_t q, co_t co, void *data, delay_ms delay);</code>,<br/><code>evq_event_t evq_resume_every(evq_queue_t q, co_t co, void *data, delay_ms period);</code></h3>
<p>All three of these functions operate in exactly the same way as their <code>evq_queue_*()</code> counterparts except that they are for coroutine events, not callback function events.  The only change in the parameters is that there is no <code>cb</code> parameter.  It is instead replaced with:</p>
<p><code>co</code> (in)</p>
<blockquote>
<p>The coroutine to be activated when the event fires.</p>
</blockquote>
<hr />
<h3 id="void-evq_processevq_queue_t-q-evq_idle-i"><code>void evq_process(evq_queue_t q, evq_idle i);</code></h3>
<p>Start processing events without returning.</p>
<p><code>q</code> (in)</p>
<blockquote>
<p>The root queue to process.</p>
</blockquote>
<p><code>i</code> (in)</p>
<blockquote>
<p>The idle function to call when all events have been processed.</p>
</blockquote>
<p>Note that in general queues should be created and attached before this loop is started.  Nested queues that aren't attached will not be serviced with this function call.  If this function ever returns, this signifies a serious error.</p>
<hr />
<h3 id="void-evq_process_forevq_queue_t-q-delay_ms-ms-evq_idle-i"><code>void evq_process_for(evq_queue_t q, delay_ms ms, evq_idle i);</code></h3>
<p>Start processing events, returning after a provided time has expired.</p>
<p><code>q</code>, <code>i</code> (in)</p>
<blockquote>
<p>The same as the equivalent parameters of <code>evq_process()</code>.</p>
</blockquote>
<p><code>ms</code> (in)</p>
<blockquote>
<p>The number of milliseconds to process the queue before returning.</p>
</blockquote>
<p>A non-blocking delay can be performed with this function, among other uses.</p>
<hr />
<h3 id="void-evq_process_one_tickevq_queue_t-q-evq_idle-i"><code>void evq_process_one_tick(evq_queue_t q, evq_idle i);</code></h3>
<p>Process all currently-due events, then return.</p>
<p><code>q</code>, <code>i</code> (in)</p>
<blockquote>
<p>The same as the equivalent parameters of <code>evq_process()</code>.</p>
</blockquote>
<p>This function is most useful for ensuring that higher-priority events are processed before lower-priority ones, remembering that processing a child does <em>not</em> process parents' events.</p>
<hr />
              
            </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="../03_comp/" class="btn btn-neutral float-right" title="comp.h">Next <span class="icon icon-circle-arrow-right"></span></a>
      
      
        <a href="../01_co/" class="btn btn-neutral" title="co.h"><span class="icon icon-circle-arrow-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <!-- Copyright etc -->
    
  </div>

  Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
      
        </div>
      </div>

    </section>

  </div>

  <div class="rst-versions" role="note" aria-label="versions">
    <span class="rst-current-version" data-toggle="rst-current-version">
      
      
        <span><a href="../01_co/" style="color: #fcfcfc;">&laquo; Previous</a></span>
      
      
        <span style="margin-left: 15px"><a href="../03_comp/" style="color: #fcfcfc">Next &raquo;</a></span>
      
    </span>
</div>
    <script>var base_url = '../..';</script>
    <script src="../../js/theme.js" defer></script>
      <script src="../../search/main.js" defer></script>
    <script defer>
        window.onload = function () {
            SphinxRtdTheme.Navigation.enable(true);
        };
    </script>

</body>
</html>
